# -*- coding:utf-8 -*-

from rest_framework.serializers import ModelSerializer
from models import ResourceManagement, PlayingQueue, PlayingQueueMaterial, AuthorityCodePlayingQueueRelation
from manufacturer.models import AuthorityCode


class ResourceManagementListSerializer(ModelSerializer):
    """ 列表 """

    class Meta:
        model = ResourceManagement
        fields = ("id", "name", "rtype", "play_mode", "ttype", "file_size")


class ResourceManagementSerializer(ModelSerializer):
    """ 创建 """

    class Meta:
        model = ResourceManagement
        fields = ("id", "name", "rtype", "play_mode", "ttype", "file")


class ResourceManagementDetailSerializer(ModelSerializer):
    """ 详情 """
    class Meta:
        model = ResourceManagement
        fields = ("id", "name", "rtype", "play_mode", "ttype", "file")


class ResourceManagementPartialSerializer(ModelSerializer):
    """ 获取照片或视频 """
    class Meta:
        model = ResourceManagement
        fields = ("file", "id", "name")


class PlayingQueueListSerializer(ModelSerializer):
    """ 列表 """
    class Meta:
        model = PlayingQueue
        fields = ("id", "name", "qtype", "qdesc", "ttype", "create_user", "update_user", "update_time", "create_time")


class PlayingQueueSerializer(ModelSerializer):
    """ 创建 """
    class Meta:
        model = PlayingQueue
        fields = ("id", "name", "qtype", "qdesc", "ttype", "create_user", "update_user")


class PlayingQueueDetailSerializer(ModelSerializer):
    """ 详情 """
    class Meta:
        model = PlayingQueue
        fields = ("id", "name", "qtype", "qdesc", "ttype", "create_user", "update_user", "update_time", "create_time")


class PlayingQueueMaterialListSerializer(ModelSerializer):
    """ 列表 """

    class Meta:
        model = PlayingQueueMaterial
        fields = ("id", "play_queue", "pqtype", "play_mode", "ntype", "dtype", "is_disabled", "play_time",
                  "retention_time", "content", "start_time", "end_time", "start_day", "end_day", "qdesc", "create_user",
                  "update_user", "resources")


class PlayingQueueMaterialSerializer(ModelSerializer):
    """ 创建 修改 """
    class Meta:
        model = PlayingQueueMaterial
        fields = ("id", "play_queue", "pqtype", "play_mode", "ntype", "dtype", "is_disabled", "play_time",
                  "retention_time", "content", "start_time", "end_time", "start_day", "end_day", "qdesc", "create_user",
                  "update_user")


class PlayingQueueMaterialDetailSerializer(ModelSerializer):
    """ 详情 """
    class Meta:
        model = PlayingQueueMaterial
        fields = ("id", "play_queue", "pqtype", "play_mode", "ntype", "dtype", "is_disabled", "play_time",
                  "retention_time", "content", "start_time", "end_time", "start_day", "end_day", "qdesc", "create_user",
                  "update_user", "resources")


class AuthorityCodeSerializer(ModelSerializer):

    class Meta:
        model = AuthorityCode
        fields = ("id", "device_code_elevator", "property_company_name", "address", "elevator_code")



























